# import random
# import requests
#
# requested_url = set()
# urls = [f'https://httpbin.org/get?value={random.randint(1,10)}' for i in range(10)]
#
#
# for url in urls:
#     if url not in requested_url:
#         requested_url.add(url)
#         res =  requests.get(url)
#         print(res.json())
#
#     else:
#         print('该网址爬取过了',url)


import hashlib
import requests
import random
import json
url = f'https://httpbin.org/post'
datas = [{"id":101,"value":random.randint(1,10)} for i in range(10)]

requested_data = set()
for data in datas:
    data_hash = hashlib.md5(json.dumps(data).encode('utf-8')).hexdigest()
    if data_hash not in requested_data:
        requested_data.add(data_hash)
        res =  requests.post(url, data=data)
        print(res.json())

    else:
        print('该网址爬取过了',datas)




